package com.augus.swagger.controller;

import com.augus.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


//  ApiOperation接口

@RestController
public class HelloController {

  // 默认请求 /error
  @GetMapping(value = "/hello")
  public String hello(){
    return "hello";
  }

  // 只要我们的接口中,返回值存在,他就会被什么到Swagger中
  @PostMapping(value = "/user")
  public User user(){
    return new User();
  }


  @ApiOperation("Hello控制类")
  @PostMapping(value = "/hello2")
  public String hello2(@ApiParam("用户名") String username){
    return "hello"+username;
  }

  @ApiOperation("POST控制类")
  @PostMapping(value = "/Postt")
  public User Postt(@ApiParam("用户名") User user){
    return user;
  }
}
